package com.zr.gdms.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import net.sf.json.JSONArray;

import com.zr.gdms.model.Student;
import com.zr.gdms.service.StudentService;
import com.zr.gdms.serviceimpl.StudentServiceImpl;

/**
 * @author  shichongming
 * @E-mail: 
 * @date 创建时间：2017年5月31日 上午10:50:41 
 * @version 1.0 
 * @parameter  
 * @since  
 * @return  
 */

public class SearchCourseControllerSCM extends HttpServlet{
StudentService stu=new StudentServiceImpl();
	
	//查询学生已选择的课题
	
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		
		doPost(req, resp);
	}
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		req.setCharacterEncoding("UTF-8");
		resp.setCharacterEncoding("UTF-8");
		HttpSession session = req.getSession();
		Student st=(Student)session.getAttribute("student");   
	    int sid=st.getSid();
	 
	    JSONArray js=stu.sfindCourseBySid(sid);
		PrintWriter pw=resp.getWriter();
		pw.write(js.toString());
		
	}
}
